package com.zlzlib.log.tools;


import javax.servlet.http.HttpServletRequest;
import java.util.*;

/**
 * @DateTime: 2023/3/21 18:50
 * @Author zlz
 * @Version 1.0
 */
public class LogLibUtils {

    /**
     * 获得请求头数据
     *
     * @param request 请求
     * @return 头部数据
     */
    public static Map<String, String> getHeaders(HttpServletRequest request, String[] key) {
        Map<String, String> header = new HashMap<>(key.length);
        for (String s : key) {
            String headerValue = request.getHeader(s);
            header.put(s, headerValue == null ? "" : headerValue);
        }
        return header;
    }

}
